package Dao;


import Model.permission.*;
import org.apache.ibatis.annotations.Param;


import java.util.List;

public interface RoleMapper {

    List<Role> findList ();

    RoleVO findRoleAndPerms(Integer id);

    /**
     * 查询权限树列表
     * @return
     */
    List<Permission> findPerms();

    int updateByPrimaryKeySelective(Role record);

    int insert1(RolePermissionKey record);

    List<RolePermissionKey> findByRole(int roleId);

    int deleteByPrimaryKey1(RolePermissionKey key);

    int deleteByPrimaryKey(Integer key);

    int insert(Role record);

    List<Role> getRolesByInsertTime();




    int insertPerm(Permission record);

    int updateByPrimaryKeySelectivePerm(Permission record);

    Permission selectByPrimaryKeyPerm(Integer id);

    /**
     * 查找所有子节点
     * @param pid
     * @return
     */
    List<Permission> findChildPerm(int pid);

    int deleteByPrimaryKeyPerm(Integer key);

    /**
     * 查找角色对应的权限Id
     * @param roleId
     * @return
     */
    List<Integer> selectPermissionIdOfRole(@Param("roleId") int roleId);


    List<Permission> selectPermissionOfRole(@Param("roleId") int roleId);

    List<Permission> getUserPerms(@Param("userId") Integer userId);
}